using System;
using System.Collections.Generic;
using System.Collections;
using System.Text;
using System.Configuration;
using System.Data.SqlClient;
using System.Web;
using System.Data;
using Microsoft.AceEngineering.SPM.SPMCustomDataEntity;
using Microsoft.ApplicationBlocks.Data;

namespace Microsoft.AceEngineering.SPM.SPMDataLayer
{
    public class ContactsDL
    {
        public static ArrayList GetContactsData(int appID)
        {
            SqlDataReader sqlreader = null;
            ArrayList contactNames = new ArrayList();

            try
            {
                string conString = ConfigurationManager.ConnectionStrings["SPMSQL"].ConnectionString;

                SqlParameter[] myParams = new SqlParameter[1];
                myParams[0] = new SqlParameter("@appID", SqlDbType.Int, 50);
                myParams[0].Value = appID;

                sqlreader = SqlHelper.ExecuteReader(conString, CommandType.StoredProcedure, "SPM_spSelectApplicationContacts", myParams);

                while (sqlreader.Read())
                {
                    contactNames.Add(sqlreader.GetValue(0).ToString());
                }
            }
            finally
            {
                if (sqlreader != null)
                {
                    if (!sqlreader.IsClosed)
                        sqlreader.Close();
                }
            }
            return contactNames;
        }
    }
}
